<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .box {
        width: 100px;
        height: 100px;
        border: dashed 2px #ccc;
        position: relative;
    }

    input[type="file"] {
        position: absolute;
        left: 0;
        top: 0;
        opacity: 0;
        width: 100px;
        height: 100px;
        z-index: 1;
    }
</style>
<body>
    <div class="box">
        <input type="file" />
    </div>

    <script src="http://unpkg.com/jquery"></script>
<script>
    $("input[type=file]").change(function () {
        const reader = new FileReader();
        reader.readAsDataURL(this.files[0]);
        reader.onload = (e) => {
            $(".box").css({
                backgroundImage: `url(${e.target.result})`,
                backgroundSize: "100% 100%",
            });
        };
    });
</script>
</body>
</html>